home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt32s3.arc / PIBTERM.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-11-30  |  45.6 KB  |  1,058 lines

  1. (*$C-,V-,U-,R-,K-*)
  2. PROGRAM PibTerm;
  3.  
  4. (*----------------------------------------------------------------------*)
  5. (*               PibTerm --- Terminal Emulator in Turbo Pascal          *)
  6. (*----------------------------------------------------------------------*)
  7. (*                                                                      *)
  8. (*  Author:   (c) 1985 by Philip R. Burns                               *)
  9. (*                                                                      *)
  10. (*  Date:     November, 1985                                            *)
  11. (*  Version:  1.0  (January, 1985)                                      *)
  12. (*            2.0  (July, 1985)                                         *)
  13. (*            3.0  (October, 1985)                                      *)
  14. (*            3.2  (November, 1985)                                     *)
  15. (*                                                                      *)
  16. (*  Systems:  For MS-DOS on IBM PCs and close compatibles only.         *)
  17. (*            Note:  I have checked these on Zenith 151s under          *)
  18. (*                   MSDOS 2.1 and IBM PCs under PCDOS 2.0.             *)
  19. (*                                                                      *)
  20. (*                   I have also successfully run PibTerm under         *)
  21. (*                   SoftLogic's DoubleDos.                             *)
  22. (*                                                                      *)
  23. (*  Overview: This program provides a comprehensive terminal emulation  *)
  24. (*            and remote communications facility.  PibTerm emulates     *)
  25. (*            five different types of terminals:                        *)
  26. (*                                                                      *)
  27. (*               (1)  Dec VT52                                          *)
  28. (*               (2)  Dec VT100 (ANSI)                                  *)
  29. (*               (3)  BBS ANSI (DEC private codes not interpreted)      *)
  30. (*               (4)  Dumb "glass" TTY                                  *)
  31. (*               (5)  Split-screen dumb-terminal mode                   *)
  32. (*                                                                      *)
  33. (*            PibTerm allows for file transfer facilities using         *)
  34. (*            several different protocols:                              *)
  35. (*                                                                      *)
  36. (*               (1)  Ascii capture                                     *)
  37. (*               (2)  Xmodem checksum and CRC                           *)
  38. (*               (3)  Modem7                                            *)
  39. (*               (4)  Telink                                            *)
  40. (*               (5)  Ymodem                                            *)
  41. (*               (6)  Kermit                                            *)
  42. (*               (7)  CompuServe B                                      *)
  43. (*                                                                      *)
  44. (*            The commands and general program use follow that of the   *)
  45. (*            popular PC-TALK and QMODEM programs.                      *)
  46. (*                                                                      *)
  47. (*            PibTerm also provides a simple host communications        *)
  48. (*            facility like a mini-BBS.                                 *)
  49. (*                                                                      *)
  50. (*----------------------------------------------------------------------*)
  51. (*                                                                      *)
  52. (*                            Restriction                               *)
  53. (*                            -----------                               *)
  54. (*                                                                      *)
  55. (*           You may use this code only for NON COMMERCIAL purposes     *)
  56. (*           unless you explicitly obtain my permission.  I take a dim  *)
  57. (*           view of others making money on my work and those of other  *)
  58. (*           people whose code I've inserted here.                      *)
  59. (*                                                                      *)
  60. (*           Please feel free to add new features.  I wrote this        *)
  61. (*           program to give people a useful and usable basic terminal  *)
  62. (*           facility, and to show how Turbo Pascal can be used for     *)
  63. (*           asynchronous communications, menu display, windowing, and  *)
  64. (*           so on.  I hope that you find this program useful -- and,   *)
  65. (*           if you expand upon it, please upload your extensions so    *)
  66. (*           that all of us can enjoy them!                             *)
  67. (*                                                                      *)
  68. (*----------------------------------------------------------------------*)
  69. (*                                                                      *)
  70. (*           Suggestions for improvements or corrections are welcome.   *)
  71. (*           Please leave messages on Gene Plantz's BBS (312) 882 4145  *)
  72. (*           or Ron Fox's BBS (312) 940 6496.                           *)
  73. (*                                                                      *)
  74. (*----------------------------------------------------------------------*)
  75.  
  76. (*$IGLOBTYPE.PAS *)
  77. (*$IASCII.PAS    *)
  78.  
  79. (*----------------------------------------------------------------------*)
  80. (*                   GLOBAL VARIABLE DEFINITIONS                        *)
  81. (*----------------------------------------------------------------------*)
  82.  
  83. CONST
  84.    Pibterm_Version = '3.2.5 (November, 1985)' (* Version no. of PibTerm   *);
  85.    Max_Screen_Col  = 80                     (* PC's screen width        *);
  86.  
  87. (*----------------------------------------------------------------------*)
  88. (*                   PibTerm Command Types                              *)
  89. (*----------------------------------------------------------------------*)
  90.  
  91. CONST
  92.    No_Of_PibTerm_Commands           = 58;
  93.    No_Of_Pibterm_Commands_Minus_One = 57;
  94.  
  95. TYPE
  96.    PibTerm_Command_Type = ( AddLFSy,     AreaCodeSy,  BreakSy,    CaptureSy,
  97.                             CaseSy,
  98.                             ClearSy,     DelaySy,     DialSy,     DosSy,
  99.                             EchoSy,      EditSy,      ElseSy,     EndCaseSy,
  100.                             EndIfSy,     EndWhileSy,  ExitSy,     FastCSy,
  101.                             FileSy,      GossipSy,    GoToSy,     HangUpSy,
  102.                             HostSy,      IfConSy,     IfFoundSy,  IfLocStrSy,
  103.                             IfRemStrSy,  InfoSy,      InputSy,    KeyDefSy,
  104.                             KeySendSy,   KeySy,       LabelSy,    LogSy,
  105.                             MessageSy,   MuteSy,      OtherSy,    ParamSy,
  106.                             QuitSy,
  107.                             ReceiveSy,   ReDialSy,    RepeatSy,   ResetSy,
  108.                             RInputSy,    SDumpSy,     SendSy,     STextSy,
  109.                             SuspendSy,   TextSy,
  110.                             TimersSy,    TranslateSy, UntilSy,    ViewSy,
  111.                             WaitSy,      WaitStrSy,   WhenSy,     WhileSy,
  112.                             Bad_Command, Null_Command
  113.                           );
  114.  
  115.                                    (* Command to be executed *)
  116. VAR
  117.    PibTerm_Command : PibTerm_Command_Type;
  118.  
  119.                                    (* Conversion table from input to *)
  120.                                    (* commands.                      *)
  121. VAR
  122.    PibTerm_Command_Table : ARRAY[0..255] OF PibTerm_Command_Type;
  123.  
  124.  
  125. (*----------------------------------------------------------------------*)
  126. (*                      Timing constants                                *)
  127. (*----------------------------------------------------------------------*)
  128.  
  129. CONST
  130.    One_Second_Delay        = 1000  (* Delay argument for 1 second delay *);
  131.    Two_Second_Delay        = 2000  (* Delay argument for 2 second delay *);
  132.    Three_Second_Delay      = 3000  (* Delay argument for 3 second delay *);
  133.    Tenth_of_a_second_Delay = 100   (* 1/10 second delay                 *);
  134.  
  135. VAR
  136.    Delay_Time : INTEGER;           (* Time to delay in response to DELAY *)
  137.                                    (* command                            *)
  138.  
  139. (*----------------------------------------------------------------------*)
  140. (*                          Text/Menu Colors                            *)
  141. (*----------------------------------------------------------------------*)
  142.  
  143. VAR
  144.    ForeGround_Color : INTEGER      (* Color for ordinary text           *);
  145.    BackGround_Color : INTEGER      (* Usual background color            *);
  146.  
  147.    Menu_Text_Color  : INTEGER      (* Color for menu text               *);
  148.    Menu_Frame_Color : INTEGER      (* Color for menu frame              *);
  149.  
  150.    Text_Mode        : INTEGER      (* Text mode for all text            *);
  151.    Blinking_On      : INTEGER      (* >0 if blinking turned on          *);
  152.  
  153. (*----------------------------------------------------------------------*)
  154. (*                    VT100 emulation colors                            *)
  155. (*----------------------------------------------------------------------*)
  156.  
  157.    VT100_ForeGround_Color : INTEGER  (* VT100 foreground color         *);
  158.    VT100_BackGround_Color : INTEGER  (* VT100 background color         *);
  159.    VT100_Underline_Color  : INTEGER  (* VT100 foreground color         *);
  160.    VT100_Bold_Color       : INTEGER  (* VT100 background color         *);
  161.  
  162. (*----------------------------------------------------------------------*)
  163. (*                      Program Option Flags                            *)
  164. (*----------------------------------------------------------------------*)
  165.  
  166. VAR
  167.    Local_Echo          : BOOLEAN   (* Local Echo ON/OFF                 *);
  168.    BS_Char             : CHAR      (* CHAR to send when Back Space hit  *);
  169.    Ctrl_BS_Char        : CHAR      (* CHAR to send when CTRL BS hit     *);
  170.    Silent_Mode         : BOOLEAN   (* TRUE to suppress bells, music.    *);
  171.    Printer_On          : BOOLEAN   (* Echo to printer                   *);
  172.    Capture_On          : BOOLEAN   (* Capture mode on                   *);
  173.    Exact_Capture       : BOOLEAN   (* TRUE for exact capture mode       *);
  174.    Translate_On        : BOOLEAN   (* Translate mode on                 *);
  175.    Ansi_Graphics_On    : BOOLEAN   (* If ansi graphics mode on          *);
  176.    Add_LF              : BOOLEAN   (* Add line feeds to incoming lines  *);
  177.    Play_Music_On       : BOOLEAN   (* Play music if found               *);
  178.    Pibterm_Done        : BOOLEAN   (* Finished running PibTerm          *);
  179.    Gossip_Mode_On      : BOOLEAN   (* Split-screen gossip mode          *);
  180.    Reset_Comm_Port     : BOOLEAN   (* TRUE to reset comm port           *);
  181.    Comm_Port_Changed   : BOOLEAN   (* TRUE if comm port number changed  *);
  182.    Host_Mode           : BOOLEAN   (* TRUE if PibTerm in host mode      *);
  183.    Last_Column_Hit     : BOOLEAN   (* TRUE if col 80 hit in display     *);
  184.    Auto_Wrap_Mode      : BOOLEAN   (* TRUE for autowrap on long lines   *);
  185.    Exploding_Menus     : BOOLEAN   (* TRUE to use exploding menus       *);
  186.    Review_On           : BOOLEAN   (* TRUE if review buffer used        *);
  187.    Script_File_Mode    : BOOLEAN   (* TRUE if currently exec'ing script *);
  188.    CompuServe_B_On     : BOOLEAN   (* CompuServe B protocol in VT52     *);
  189.    Mahoney_On          : BOOLEAN   (* Mahoney BBS codes allowed in VT52 *);
  190.    When_Mode           : BOOLEAN   (* TRUE if WHEN string defined       *);
  191.    WaitString_Mode     : BOOLEAN   (* TRUE if WAITSTRING string defined *);
  192.    Read_In_Script      : BOOLEAN   (* TRUE to read in script            *);
  193.    Really_Wait_String  : BOOLEAN   (* TRUE to really wait for string    *);
  194.    Write_Screen_Memory : BOOLEAN   (* TRUE to write video memory direct *);
  195.    Alter_Baud_Rate     : BOOLEAN   (* TRUE to get baud rate from modem  *);
  196.    Check_CTS           : BOOLEAN   (* TRUE to check clear-to-send line  *);
  197.    Check_DSR           : BOOLEAN   (* TRUE to check data-set-ready line *);
  198.  
  199. (*----------------------------------------------------------------------*)
  200. (*                           Global files                               *)
  201. (*----------------------------------------------------------------------*)
  202.  
  203. TYPE
  204.    Text_File      = TEXT [512]     (* General text file                 *);
  205.  
  206. VAR
  207.    Config_File    : Text_File      (* Global configuration file         *);
  208.    Capture_File   : Text_File      (* Capture file                      *);
  209.    Xfer_List_File : Text_File      (* File transfer list file           *);
  210.    Command_File   : Text_File      (* Command file                      *);
  211.    Script_File    : Text_File      (* Script file                       *);
  212.  
  213.    Capture_File_Name : FileStr     (* Capture file name                 *);
  214.  
  215.    Home_Dir_Path     : FileStr     (* Home Directory Path for PibTerm   *);
  216.    Home_Dir          : FileStr     (* Home Directory for PibTerm        *);
  217.    Home_Drive        : CHAR        (* Home Drive Letter for PibTerm     *);
  218.  
  219.    Screen_Dump_Name  : FileStr     (* Screen dump file name             *);
  220.    Script_File_Name  : FileStr     (* Script file name                  *);
  221.  
  222. (*----------------------------------------------------------------------*)
  223. (*                         Review buffer                                *)
  224. (*----------------------------------------------------------------------*)
  225.  
  226. TYPE
  227.    Review_Buffer_Type = ARRAY[1..1] OF STRING[80];
  228.    Review_Buffer_Ptr  = ^Review_Buffer_Type;
  229.  
  230. VAR
  231.    Max_Review_Length : INTEGER     (* Number of lines in review buffer *);
  232.  
  233.                                    (* Review buffer pointer *)
  234.    Review_Buffer:  Review_Buffer_Ptr;
  235.  
  236.    Review_Line  :  AnyStr          (* Current line                      *);
  237.    Review_Head  :  INTEGER         (* Head of review buffer             *);
  238.    Review_Tail  :  INTEGER         (* Tail of review buffer             *);
  239.  
  240. (*----------------------------------------------------------------------*)
  241. (*                   Incoming/Outgoing key definitions                  *)
  242. (*----------------------------------------------------------------------*)
  243.  
  244.                                    (* Keypad key strings                *)
  245.  
  246.    Keypad_Keys      : ARRAY[1..3] OF ARRAY[1..10] OF STRING[12];
  247.  
  248.                                    (* Maps input key to Keypad_Key      *)
  249.  
  250.    Keypad_Key_Index : ARRAY[0..255] OF BYTE;
  251.  
  252.                                    (* Keypad key names                  *)
  253.  
  254.    Keypad_Key_Names : ARRAY[1..3] OF ARRAY[1..10] OF STRING[4];
  255.  
  256.                                    (* Function key definitions          *)
  257.  
  258.    Function_Keys    : ARRAY[1..4] OF ARRAY[1..10] OF KeyStr;
  259.  
  260.    Key_No           : INTEGER      (* Key number to execute             *);
  261.  
  262.    FK_CR        : CHAR             (* Function key definition CR        *);
  263.    FK_Delay     : CHAR             (* Function key def. 1 second wait   *);
  264.    FK_Wait_For  : CHAR             (* Function key wait for next char   *);
  265.    FK_Ctrl_Mark : CHAR             (* Marks next char as ctrl character *);
  266.    FK_Script_Ch : CHAR             (* Script to execute follows         *);
  267.                                    (* Incoming character translate table *)
  268.    TrTab        : ARRAY[CHAR] OF CHAR;
  269.  
  270. (*----------------------------------------------------------------------*)
  271. (*               Global communications variables                        *)
  272. (*----------------------------------------------------------------------*)
  273.  
  274. VAR
  275.    Data_Bits   : 5..8;
  276.    Parity      : CHAR;
  277.    Stop_Bits   : 0..2;
  278.    Comm_Port   : 1..2;
  279.    Baud_Rate   : 110..9600;
  280.  
  281. (*----------------------------------------------------------------------*)
  282. (*          Global variables for view file/directory/area codes         *)
  283. (*----------------------------------------------------------------------*)
  284.  
  285. VAR
  286.    View_Count     : INTEGER;
  287.    View_Line      : STRING[128];
  288.    View_Done      : BOOLEAN;
  289.    View_Char      : STRING[1];
  290.    View_Y         : INTEGER;
  291.  
  292. (*----------------------------------------------------------------------*)
  293. (*           Types and Variables for Terminal Emulation Facilities      *)
  294. (*----------------------------------------------------------------------*)
  295.  
  296. TYPE
  297.    Terminal_Type = ( Dumb, VT52, Ansi, VT100, Gossip, HostMode, TV920,
  298.                      TEK4014, VT220 );
  299.  
  300. VAR
  301.                                    (* Type of terminal to emulate      *)
  302.    Terminal_To_Emulate : Terminal_Type;
  303.  
  304.                                    (* Saves previous term. type        *)
  305.    Saved_Gossip_Term   : Terminal_Type;
  306.  
  307.  
  308. (*----------------------------------------------------------------------*)
  309. (*           Global variables for phone directory handling              *)
  310. (*----------------------------------------------------------------------*)
  311.  
  312. CONST
  313.    Max_Phone_Prefixes        = 5;
  314.    Max_Dial_Numbers          = 5;
  315.    Default_Phone_Number_Size = 200;
  316.  
  317. (* STRUCTURED *) CONST
  318.    Phone_Prefix_Chars   : ARRAY[ 1 .. Max_Phone_Prefixes ] OF CHAR
  319.                           = ( '+', '-', '!', '@', '#' );
  320.  
  321. TYPE
  322.  
  323.    Char_25  = PACKED ARRAY[ 1 .. 25 ] OF CHAR;
  324.    Char_15  = PACKED ARRAY[ 1 .. 15 ] OF CHAR;
  325.    Char_5   = PACKED ARRAY[ 1 .. 5  ] OF CHAR;
  326.    Char_2   = PACKED ARRAY[ 1 .. 2  ] OF CHAR;
  327.  
  328.    String30 = STRING[30];
  329.  
  330.                                    (* Dialing file entry *)
  331.    Phone_Number_Record = RECORD
  332.                             Phone_Name:     Char_25;
  333.                             Phone_Number:   Char_15;
  334.                             Phone_Baud:     Char_5;
  335.                             Phone_Parity:   CHAR;
  336.                             Phone_DataBits: CHAR;
  337.                             Phone_StopBits: CHAR;
  338.                             Phone_ENDer   : Char_2;
  339.                          END;
  340.  
  341.                                    (* Dialing file       *)
  342.  
  343.    Phone_File_Type = FILE OF Phone_Number_Record;
  344.  
  345.  
  346. VAR
  347.                                    (* Phone directory file *)
  348.    Phone_File          : Phone_File_Type;
  349.  
  350.                                    (* Current phone entry data *)
  351.    Phone_Entry_Data    : Phone_Number_Record;
  352.  
  353.                                    (* Current phone record number *)
  354.    Phone_Entry_Number  : INTEGER;
  355.                                    (* Current phone page number   *)
  356.    Phone_Entry_Page    : INTEGER;
  357.                                    (* File with phone prefixes    *)
  358.    Phone_Prefix_File   : Text_File;
  359.  
  360.                                    (* Phone prefix numbers      *)
  361.  
  362.    Phone_Prefix_Nos    : ARRAY[ 1 .. Max_Phone_Prefixes ] OF ShortStr;
  363.  
  364.    Default_Prefix      : CHAR      (* Default prefix character    *);
  365.    Default_Postfix     : CHAR      (* Default postfix character   *);
  366.    Phone_Number        : String30  (* Phone number to dial        *);
  367.    Prefix_Str          : ShortStr  (* Phone number prefix         *);
  368.    Postfix_Str         : ShortStr  (* Phone number postfix        *);
  369.  
  370.    Modem_Init          : ShortStr  (* Modem initialization string *);
  371.  
  372.    Modem_Dial          : ShortStr  (* Modem dialing command       *);
  373.    Modem_Busy          : ShortStr  (* Modem return if line busy   *);
  374.    Modem_Connect       : ShortStr  (* Modem connect message       *);
  375.    Modem_No_Carrier    : ShortStr  (* Modem no carrier message    *);
  376.    Modem_Escape        : ShortStr  (* Modem escape command        *);
  377.    Modem_Escape_Time   : INTEGER   (* Time in mil. for escape     *);
  378.    Modem_Hang_Up       : ShortStr  (* Modem hangup command        *);
  379.    Modem_Time_Out      : REAL      (* Modem time out value        *);
  380.    Modem_Redial_Delay  : REAL      (* Modem redial delay          *);
  381.    Modem_Answer        : ShortStr  (* Modem answer phone          *);
  382.    Modem_Host_Set      : ShortStr  (* Modem host mode setup       *);
  383.    Modem_Command_Delay : INTEGER   (* Ms between command chars    *);
  384.    Modem_Carrier_High  : BOOLEAN   (* TRUE if carrier line high   *);
  385.    Host_Auto_Baud      : BOOLEAN   (* Attempt auto speed detect   *);
  386.  
  387. (*----------------------------------------------------------------------*)
  388. (*                 Global variables for music playing                   *)
  389. (*----------------------------------------------------------------------*)
  390.  
  391. VAR
  392.                                    (* Current Octave for Note *)
  393.    Note_Octave   : INTEGER;
  394.                                    (* Fraction of duration given to note *)
  395.    Note_Fraction : REAL;
  396.                                    (* Duration of note *)
  397.    Note_Duration : INTEGER;
  398.                                    (* Length of note *)
  399.    Note_Length   : REAL;
  400.                                    (* Length of quarter note (principal beat) *)
  401.    Note_Quarter  : REAL;
  402.  
  403. (*----------------------------------------------------------------------*)
  404. (*                 Global variables for file transfers                  *)
  405. (*----------------------------------------------------------------------*)
  406.  
  407. CONST
  408.                    (* Special characters used in XMODEM *)
  409.  
  410.    SOH   = $01;                    (* Start of XMODEM block       *)
  411.    STX   = $02;                    (* Start of Ymodem block       *)
  412.    EOT   = $04;                    (* End of XMODEM transmission  *)
  413.    ACK   = $06;                    (* Acknowledge an XMODEM block *)
  414.    NAK   = $15;                    (* Refuse an XMODEM block      *)
  415.    SYN   = $16;                    (* Start of Telink header      *)
  416.    CAN   = $18;                    (* Cancel XMODEM transfer      *)
  417.  
  418. TYPE
  419.    Sector_Type             = ARRAY[ 1 .. 1026 ] OF BYTE;
  420.    File_Handle_Buffer_Type = ARRAY[ 1 .. 2048 ] OF BYTE;
  421.    File_Handle_Buffer_Ptr  = ^File_Handle_Buffer_Type;
  422.  
  423. VAR
  424.    Sector_Size      : INTEGER      (* Size of Xmodem sector             *);
  425.  
  426.                                    (* One sector of data                *)
  427.    Sector_Data      : Sector_Type;
  428.  
  429.    Sector_Number    : INTEGER      (* Current sector number being sent  *);
  430.  
  431.    Max_Write_Buffer : INTEGER      (* Download buffer size              *);
  432.  
  433.  
  434.                    (* Transfer Declarations *)
  435. TYPE
  436.  
  437.    Transfer_Type = ( Ascii, Xmodem_Chk, Xmodem_CRC, Kermit, Telink,
  438.                      Modem7_Chk, Modem7_CRC, Ymodem, Ymodem_Batch, None );
  439.  
  440.    Transfer_Str  = STRING[255];
  441.  
  442. CONST
  443.    Max_Transfer_Types = 10;
  444.  
  445. (* STRUCTURED *) CONST
  446.    Transfers : ARRAY[ 1 .. Max_Transfer_Types ] OF Transfer_Type
  447.                = ( Ascii, Xmodem_Chk, Xmodem_Crc, Kermit, Telink,
  448.                    Modem7_Chk, Modem7_CRC, Ymodem, Ymodem_Batch, None );
  449.  
  450.                    (* Files for transfers *)
  451. VAR
  452.  
  453.    AFile        : TEXT [4096]      (* Ascii File uploaded/downloaded    *);
  454.    XFile_Handle : INTEGER          (* Xmodem File uploaded/downloaded   *);
  455.    FileName     : STRING[64]       (* Name of file                      *);
  456.  
  457.  
  458.                    (* Timing/Delay Constants and Variables *)
  459. CONST
  460.  
  461.    One_Second     =  1              (* One second                       *);
  462.    Two_Seconds    =  2              (* Two seconds                      *);
  463.    Five_Seconds   =  5              (* Five seconds                     *);
  464.    Ten_Seconds    = 10              (* Ten seconds                      *);
  465.    Twenty_Seconds = 20              (* Twenty seconds                   *);
  466.    Sixty_Seconds  = 60              (* Sixty seconds                    *);
  467.    Trans_Time_Val = 1800.0          (* Fudge factor for transfer times  *);
  468.  
  469. VAR
  470.  
  471.    Char_Delay  : INTEGER            (* Character delay for Ascii trans.  *);
  472.    Line_Delay  : INTEGER            (* Line delay for Ascii transfers    *);
  473.    Pacing_Char : CHAR               (* Pacing character for uploads      *);
  474.    CR_LF_String: STRING[2]          (* CR or CR+LF to end ASCII lines    *);
  475.  
  476.                    (* Save/restore transmission params during XMODEM *)
  477.  
  478. VAR
  479.    Xmodem_Bits_Save:   INTEGER     (* Save # bits per character         *);
  480.    Xmodem_Parity_Save: CHAR        (* Save parity                       *);
  481.    Xmodem_Stop_Save:   INTEGER     (* Save stop bits                    *);
  482.  
  483. VAR                                (* Default transfer type             *)
  484.    Default_Transfer_Type : Transfer_Type;
  485.  
  486. VAR
  487.    Stop_Receive    : BOOLEAN       (* TRUE to cancel receiving of file. *);
  488.    Stop_Send       : BOOLEAN       (* TRUE to cancel sending of file.   *);
  489.    Use_Time_Sent   : BOOLEAN       (* TRUE to stamp file with received  *)
  490.                                    (* time and date.                    *);
  491.    Null_File_Name  : BOOLEAN       (* TRUE if null file name in Ymodem  *);
  492.    Ascii_Use_CtrlZ : BOOLEAN       (* TRUE if CtrlZ used as EOF marker  *);
  493.    Ascii_Show_Text : BOOLEAN       (* TRUE to display text during trans.*);
  494.    Ascii_Send_Blank: BOOLEAN       (* TRUE to send empty lines as blank *);
  495.    Display_Status  : BOOLEAN       (* TRUE to display transfer status   *);
  496.  
  497. VAR
  498.    GMT_Difference: INTEGER         (* Difference in hours between local *)
  499.                                    (* time and Greenwich mean time      *);
  500. VAR
  501.    Transfer_Bells: INTEGER         (* Number of bells after transfer    *);
  502.  
  503. (*----------------------------------------------------------------------*)
  504. (*              Definitions for Kermit protocol transfers               *)
  505. (*----------------------------------------------------------------------*)
  506.  
  507. TYPE
  508.  
  509.    Kermit_Packet_String = STRING[150];
  510.  
  511.    Kermit_State_Vars = ( Send_Init,      Send_File_Header,  Send_File,
  512.                          Send_EOF,       Send_Break,        Receive_Init,
  513.                          Receive_Header, Receive_File,      Send_Bye,
  514.                          Get_File );
  515.  
  516.    Kermit_File_Param   = ( Kermit_Ascii, Kermit_Binary, Kermit_None );
  517.  
  518.    Kermit_Packet_Param = ( Break_Pack,  Data_Pack, Error_Pack,
  519.                            Header_Pack, NAK_Pack,  Send_Pack, Reserved_Pack,
  520.                            ACK_Pack,    End_Pack,  Unknown );
  521.  
  522.    Kermit_File_Modes   = ( Read_Open, Write_Open );
  523.  
  524.  
  525. CONST
  526.    Kermit_Init_Packet_Size = 94;
  527.  
  528. VAR
  529.                                    (* Type of file (Ascii, Binary) *)
  530.  
  531.    Kermit_File_Type_Var : Kermit_File_Param;
  532.  
  533.                                    (* Type of current Kermit packet *)
  534.  
  535.    Kermit_Packet_Type   : Kermit_Packet_Param;
  536.  
  537.                                    (* Current state of Kermit transfer *)
  538.  
  539.    Kermit_State         : Kermit_State_Vars;
  540.  
  541.                                    (* If remote kermit in server mode *)
  542.    Kermit_Remote_Server : BOOLEAN;
  543.  
  544.    Kermit_Packet_Size   : INTEGER  (* Size of current packet *);
  545.    Kermit_Timeout       : INTEGER  (* Timeout value in seconds *);
  546.    His_TimeOut          : INTEGER  (* Timeout desired by remote *);
  547.    Kermit_Npad          : INTEGER  (* Number of padding characters *);
  548.    Kermit_EOL           : CHAR     (* End of line character *);
  549.    Kermit_Header_Char   : CHAR     (* Block header character *);
  550.  
  551.    Kermit_Pad_Char      : CHAR     (* Padding character *);
  552.    Kermit_Quote_Char    : CHAR     (* Control-quote character *);
  553.    Kermit_Quote_8_Char  : CHAR     (* 8-bit quoting character *);
  554.    Kermit_Chk_Type      : CHAR     (* Block-check type        *);
  555.    Kermit_Repeat_Char   : CHAR     (* Repeat character        *);
  556.  
  557.                                    (* Packet buffer area       *)
  558.  
  559.    Packet_Buffer      : Kermit_Packet_String;
  560.  
  561.                                    (* Complete packet to send  *)
  562.  
  563.    Packet_Buffer_Data : Kermit_Packet_String;
  564.  
  565.                                    (* Complete packet received *)
  566.  
  567.    Rec_Packet         : Kermit_Packet_String;
  568.  
  569.    Packet_OK          : BOOLEAN    (* TRUE if packet OK        *);
  570.    Ack_OK             : BOOLEAN    (* TRUE if packet ACK'd     *);
  571.    Open_OK            : BOOLEAN    (* TRUE if file to transfer opened OK *);
  572.    File_Done          : BOOLEAN    (* TRUE if file being sent done *);
  573.    Kermit_Abort       : BOOLEAN    (* TRUE if keyboard entry aborts transfer *);
  574.    Kermit_Retry       : BOOLEAN    (* TRUE to retry current packet *);
  575.  
  576.    Packet_Num         : INTEGER    (* Packet number being sent *);
  577.    Rec_Packet_Num     : INTEGER    (* Received packet number *);
  578.    Packets_Sent       : INTEGER    (* Number of packets sent *);
  579.    Packets_Received   : INTEGER    (* Number of packets received *);
  580.    Packets_Bad        : INTEGER    (* Number of errors in transfer *);
  581.  
  582.    File_Open          : BOOLEAN    (* TRUE if file being transferred is open *);
  583.  
  584.                                    (* Received file data *)
  585.  
  586.    Received_Data      : Kermit_Packet_String;
  587.  
  588.    Quoting            : BOOLEAN    (* TRUE if 8th-bit quoting in effect *);
  589.    Repeating          : BOOLEAN    (* TRUE if repeating/compression in effect *);
  590.    Sending_File       : BOOLEAN    (* TRUE if uploading, FALSE if downloading *);
  591.    Logging_Out_Server : BOOLEAN    (* TRUE if logging out remote server       *);
  592.  
  593.    My_Pad_Char        : CHAR       (* Default pad character *);
  594.    His_Quote_Char     : CHAR       (* Remote kermit's quote character *);
  595.    His_Quote_8_Char   : CHAR       (* Remote kermit's 8th-bit quote character *);
  596.    His_Chk_Type       : CHAR       (* Remote kermit's block check type *);
  597.  
  598.    My_Pad_Num         : INTEGER    (* Default number of padding characters *);
  599.    Send_EOL           : INTEGER    (* Send CR first time *);
  600.  
  601.    File_Records       : REAL       (* Number of bytes in disk file *);
  602.    FilePointer        : INTEGER    (* Where we are in the record *);
  603.    Buffer_Num         : REAL       (* How many characters read/written *);
  604.    Kermit_Delay_Time  : INTEGER    (* Time to wait before send in host mode *);
  605.    Receive_Done       : BOOLEAN    (* TRUE if file reception complete *);
  606.    Kermit_MaxTry      : INTEGER    (* Maximum number of retries allowed *);
  607.  
  608.                                  (* TRUE to turn off remote Kermit server *)
  609.  
  610.    Finish_Kermit_Server : BOOLEAN;
  611.  
  612.                                  (* TRUE if Kermit in debug mode *)
  613.  
  614.    Kermit_Debug         : BOOLEAN;
  615.  
  616. (*----------------------------------------------------------------------*)
  617. (*                    Global script file variables                      *)
  618. (*----------------------------------------------------------------------*)
  619.  
  620. CONST
  621.    Max_Script_File_Commands = 45;
  622.  
  623. (* STRUCTURED *) CONST
  624.                                    (* Valid command names for scripts *)
  625.  
  626.    Script_File_Command_Names : ARRAY[1..Max_Script_File_Commands] OF STRING[8]
  627.                              = ( 'ADDLF',    'BREAK',    'CAPTURE',  'CASE',
  628.                                  'CLEAR',    'DELAY',    'DIAL',
  629.                                  'DOS',      'ECHO',     'ELSE',     'ENDCASE',
  630.                                  'ENDIF',
  631.                                  'ENDWHILE', 'EXIT',     'FILE',     'GOTO',
  632.                                  'HANGUP',
  633.                                  'HOST',     'IF',       'INPUT',    'KEY',
  634.                                  'KEYDEF',   'KEYSEND',
  635.                                  'LABEL',    'LOG',      'MESSAGE',  'MUTE',
  636.                                  'OTHERWIS',
  637.                                  'PARAM',    'RECEIVE',  'REDIAL',   'REPEAT',
  638.                                  'RESET',    'RINPUT',   'SCREENDUM','SEND' ,
  639.                                  'STEXT',    'SUSPEND',  'TEXT',     'TRANSLAT',
  640.                                  'UNTIL',
  641.                                  'WAIT',     'WAITSTRI', 'WHEN',     'WHILE' );
  642.  
  643.                                    (* Corresponding command types *)
  644.  
  645.    Script_File_Commands      : ARRAY[1..Max_Script_File_Commands] OF
  646.                                PibTerm_Command_Type =
  647.                                ( AddLFSy,     BreakSy,    CaptureSy,  CaseSy,
  648.                                  ClearSy,     DelaySy,    DialSy,     DosSy,
  649.                                  EchoSy,      ElseSy,     EndCaseSy,  EndIfSy,
  650.                                  EndWhileSy,  ExitSy,     FileSy,     GoToSy,
  651.                                  HangUpSy,
  652.                                  HostSy,      IfLocStrSy, InputSy,    KeySy,
  653.                                  KeyDefSy,    KeySendSy,
  654.                                  LabelSy,     LogSy,      MessageSy,  MuteSy,
  655.                                  OtherSy,     ParamSy,    ReceiveSy,  RedialSy,
  656.                                  RepeatSy,    ResetSy,    RInputSy,   SDumpSy,
  657.                                  SendSy,      STextSy,    SuspendSy,  TextSy,
  658.                                  TranslateSy, UntilSy,    WaitSy,     WaitStrSy,  WhenSy,
  659.                                  WhileSy );
  660.  
  661.                                    (* Script conversion table       *)
  662.  
  663.    PibTerm_Command_Table_2 : ARRAY[0..No_Of_PibTerm_Commands_Minus_One]
  664.                              OF PibTerm_Command_Type
  665.                              = ( AddLFSy,     AreaCodeSy,  BreakSy,    CaptureSy,
  666.                                  CaseSy,      ClearSy,     DelaySy,    DialSy,
  667.                                  DosSy,       EchoSy,      EditSy,     ElseSy,
  668.                                  EndCaseSy,   EndIfSy,     EndWhileSy, ExitSy,
  669.                                  FastCSy,     FileSy,      GossipSy,   GoToSy,
  670.                                  HangUpSy,    HostSy,      IfConSy,    IfFoundSy,
  671.                                  IfLocStrSy,  IfRemStrSy,  InfoSy,     InputSy,
  672.                                  KeyDefSy,    KeySendSy,
  673.                                  KeySy,       LabelSy,     LogSy,      MessageSy,
  674.                                  MuteSy,      OtherSy,     ParamSy,    QuitSy,
  675.                                  ReceiveSy,   ReDialSy,    RepeatSy,   ResetSy,
  676.                                  RInputSy,    SDumpSy,     SendSy,     STextSy,
  677.                                  SuspendSy,   TextSy,      TimersSy,   TranslateSy,
  678.                                  UntilSy,     ViewSy,      WaitSy,     WaitStrSy,
  679.                                  WhenSy,      WhileSy,
  680.                                  Bad_Command, Null_Command
  681.                                );
  682.  
  683. TYPE
  684.                                    (* Generic buffer type to hold script *)
  685.  
  686.    Script_Buffer_Type = ARRAY[1..1] OF BYTE;
  687.  
  688.                                    (* For pointing to start of script    *)
  689.  
  690.    Script_Buffer_Ptr  = ^Script_Buffer_Type;
  691.  
  692. VAR
  693.                                    (* WHEN text to wait for *)
  694.    Script_When_Text       : AnyStr;
  695.  
  696.                                    (* Response text for WHEN *)
  697.    Script_When_Reply_Text : AnyStr;
  698.  
  699.                                    (* Current input for WHEN checking *)
  700.    Script_When_Save       : AnyStr;
  701.  
  702.                                    (* WAITSTRING text to wait for *)
  703.    Script_Wait_Text       : AnyStr;
  704.  
  705.                                    (* Response text for WAITSTRING *)
  706.    Script_Wait_Reply_Text : AnyStr;
  707.  
  708.                                    (* Current input for WAITSTRING checking *)
  709.    Script_Wait_Save       : AnyStr;
  710.  
  711.                                    (* Time to wait for input string     *)
  712.    Script_Wait_Time       : INTEGER;
  713.  
  714.                                    (* Starting time of day for wait         *)
  715.    Script_Wait_Start      : REAL;
  716.  
  717.                                    (* Where to go to if wait string fails   *)
  718.    Script_Wait_Failure    : INTEGER;
  719.  
  720.                                    (* Wait string appeared                  *)
  721.    Script_Wait_Found      : BOOLEAN;
  722.  
  723.                                    (* Size of script buffer                 *)
  724.  
  725.    Script_Buffer_Size     : INTEGER;
  726.  
  727.                                    (* Pointer to compiled script text       *)
  728.  
  729.    Script_Buffer          : Script_Buffer_Ptr;
  730.  
  731.                                    (* Current position in script buffer     *)
  732.  
  733.    Script_Buffer_Pos      : INTEGER;
  734.  
  735.                                    (* Script integer values             *)
  736.  
  737.    Script_Integer_1       : INTEGER;
  738.    Script_Integer_2       : INTEGER;
  739.    Script_Integer_3       : INTEGER;
  740.  
  741.                                    (* Script text values                *)
  742.  
  743.    Script_String          : AnyStr;
  744.    Script_String_2        : AnyStr;
  745.  
  746.                                    (* Reply to Script INPUT prompt      *)
  747.    Script_Reply           : AnyStr;
  748.  
  749.                                    (* Reply was OK                      *)
  750.    Script_Reply_Found     : BOOLEAN;
  751.  
  752.                                    (* Script suspend time period        *)
  753.    Script_Suspend_Time    : REAL;
  754.  
  755.                                    (* Script suspend starting time      *)
  756.    Script_Suspend_Start   : REAL;
  757.  
  758.                                    (* Reply to Script RINPUT prompt     *)
  759.    Script_Remote_Reply    : AnyStr;
  760.  
  761.                                    (* Reply was OK                      *)
  762.    Script_Remote_Reply_OK : BOOLEAN;
  763.  
  764.  
  765. (*----------------------------------------------------------------------*)
  766. (*                 Global error return from DOS                         *)
  767. (*----------------------------------------------------------------------*)
  768.  
  769. VAR
  770.    Ierr : INTEGER                  (* DOS return error *);
  771.  
  772. (*----------------------------------------------------------------------*)
  773. (*                 Global screen positioning for autodownloads          *)
  774. (*----------------------------------------------------------------------*)
  775.  
  776. VAR
  777.    NewX  : INTEGER;
  778.    OldX  : INTEGER;
  779.    NewY  : INTEGER;
  780.    OldY  : INTEGER;
  781.  
  782. (*----------------------------------------------------------------------*)
  783. (*                           Session timers                             *)
  784. (*----------------------------------------------------------------------*)
  785.  
  786. VAR
  787.    Session_Start_Time: REAL        (* Starting time of entire session *);
  788.    Dialing_Start_Time: REAL        (* Starting time current dialing   *);
  789.  
  790. (*----------------------------------------------------------------------*)
  791. (*                    PibTerm Command Key Definitions                   *)
  792. (*----------------------------------------------------------------------*)
  793.  
  794. CONST
  795.    Alt_A = 30;      Alt_J = 36;      Alt_S = 31;
  796.    Alt_B = 48;      Alt_K = 37;      Alt_T = 20;
  797.    Alt_C = 46;      Alt_L = 38;      Alt_U = 22;
  798.    Alt_D = 32;      Alt_M = 50;      Alt_V = 47;
  799.    Alt_E = 18;      Alt_N = 49;      Alt_W = 17;
  800.    Alt_F = 33;      Alt_O = 24;      Alt_X = 45;
  801.    Alt_G = 34;      Alt_P = 25;      Alt_Y = 21;
  802.    Alt_H = 35;      Alt_Q = 16;      Alt_Z = 44;
  803.    Alt_I = 23;      Alt_R = 19;      Alt_1 = 120;
  804.  
  805.    Shift_Tab = 15;
  806.  
  807.    F1        = 59;  Alt_F1   = 104;
  808.    F2        = 60;  Alt_F2   = 105;
  809.    F10       = 68;  Alt_F10  = 113;
  810.    Shift_F1  = 84;  Ctrl_F1  = 94;
  811.    Shift_F10 = 93;  Ctrl_F10 = 103;
  812.  
  813.    U_Arrow   = 72;  Alt_U_Arrow = 175;  Ctrl_U_Arrow = 160;
  814.    D_Arrow   = 80;  Alt_D_Arrow = 183;  Ctrl_D_Arrow = 164;
  815.    L_Arrow   = 75;  Alt_L_Arrow = 178;  Ctrl_L_Arrow = 115;
  816.    R_Arrow   = 77;  Alt_R_Arrow = 180;  Ctrl_R_Arrow = 116;
  817.  
  818.    Home      = 71;  Alt_Home    = 174;
  819.    End_Key   = 79;  Alt_End_Key = 182;  Ctrl_End_Key  = 117;
  820.    PgUp      = 73;  Alt_PgUp    = 176;  Ctrl_PgUp     = 132;
  821.    PgDn      = 81;  Alt_PgDn    = 184;  Ctrl_PgDn     = 118;
  822.    Ins_Key   = 82;  Alt_Ins_Key = 185;  Ctrl_Ins_Key  = 165;
  823.    Del_Key   = 83;  Alt_Del_Key = 186;  Ctrl_Del_Key  = 166;
  824.  
  825. (*----------------------------------------------------------------------*)
  826. (*                 --- Included procedures for PibTerm ---              *)
  827. (*----------------------------------------------------------------------*)
  828.  
  829. PROCEDURE Display_Character( Ch : CHAR );
  830.    FORWARD;
  831.  
  832. PROCEDURE Process_Command( VAR Ch       : CHAR;
  833.                                Use_Ch   : BOOLEAN;
  834.                            VAR Command  : PibTerm_Command_Type );
  835.    FORWARD;
  836.  
  837. PROCEDURE Execute_Command( VAR Command    : Pibterm_Command_Type;
  838.                            VAR Done       : BOOLEAN;
  839.                                Use_Script : BOOLEAN );
  840.    FORWARD;
  841.  
  842. (*$IINT24.PAS    *)
  843. (*$IMINMAX.PAS   *)
  844. (*$IYESNO.PAS    *)
  845. (*$IDUPL.PAS     *)
  846. (*$IUPPERCAS.PAS *)
  847. (*$ICOPYSTOA.PAS *)
  848. (*$IMAXBLOCK.PAS *)
  849. (*$IREADCTRL.PAS *)
  850. (*$IWRITCTRL.PAS *)
  851. (*$IPIBTIMER.PAS *)
  852. (*$IPIBASYN1.PAS *)
  853. (*$IPIBASYN2.PAS *)
  854. (*$IPIBSCREN.PAS *)
  855. (*$ICLEARWIN.PAS *)
  856. (*$IPIBMENUS.PAS *)
  857. (*$IPIBDIR.PAS   *)
  858. (*$IPIBFHIO.PAS  *)
  859. (*$ITRIM.PAS     *)
  860. (*$ILTRIM.PAS    *)
  861. (*$ISENDMODE.PAS *)
  862. (*$IVIEWPMPT.PAS *)
  863. (*$IPIBCRC.PAS   *)
  864. (*$IHANGUP.PAS   *)
  865. (*$ISCANXFER.PAS *)
  866. (*$IERRORHAN.PAS *)
  867. (*$ICAPTUREC.PAS *)
  868. (*$IWRITELNE.PAS *)
  869. (*$IINITOVLY.PAS *)
  870.  
  871. (*----------------------------------------------------------------------*)
  872. (*                 First overlay segment starts here.                   *)
  873. (*----------------------------------------------------------------------*)
  874.  
  875. (*$ISETTRTAB.PAS *)
  876. (*$ISETINPTK.PAS *)
  877. (*$IDISPHELP.PAS *)
  878. (*$IPIBDIALA.PAS *)
  879. (*$IPIBDIALB.PAS *)
  880. (*$IPIBFMANI.PAS *)
  881.  
  882. (*-------------------------- Upload procedures -------------------------*)
  883.  
  884. (*$IPIBUPLOD.PAS *)
  885. (*$IGETUPLOA.PAS *)
  886.                                    (* Xmodem family *)
  887. (*$IDOXMODU1.PAS *)
  888. (*$ISENDXMOD.PAS *)
  889. (*$ISENDMDM7.PAS *)
  890. (*$ISENDYMOD.PAS *)
  891. (*$IDOXMODU2.PAS *)
  892.                                    (* Ascii *)
  893. (*$ISENDASCI.PAS *)
  894.                                    (* Kermit *)
  895. (*$ISENDKER1.PAS *)
  896. (*$IKINIT.PAS    *)
  897. (*$IKERMCRC.PAS  *)
  898. (*$IKDISPLAY.PAS *)
  899. (*$IADJUSTFN.PAS *)
  900. (*$IKOPEN.PAS    *)
  901. (*$IKREC1.PAS    *)
  902. (*$IKSEND1.PAS   *)
  903. (*$ISENDKER2.PAS *)
  904. (*$IPIBUPLOB.PAS *)
  905.  
  906. (*-------------------------End Upload procedures -----------------------*)
  907.  
  908. (*------------------------ Download procedures -------------------------*)
  909.  
  910. (*$IPIBDWLOD.PAS *)
  911. (*$IGETDOWNL.PAS *)
  912.                                    (* Xmodem family *)
  913. (*$IDOXMODD1.PAS *)
  914. (*$IRECEIVEX.PAS *)
  915. (*$IRECEIVEM.PAS *)
  916. (*$IRECEIVEY.PAS *)
  917. (*$IDOXMODD2.PAS *)
  918.                                    (* Ascii *)
  919. (*$IRECEIVEA.PAS *)
  920.                                    (* Kermit *)
  921. (*$IRECEIVK1.PAS *)
  922. (*$IKINIT.PAS    *)
  923. (*$IKERMCRC.PAS  *)
  924. (*$IKDISPLAY.PAS *)
  925. (*$IKFIXFNAM.PAS *)
  926. (*$IADJUSTFN.PAS *)
  927. (*$IKOPEN.PAS    *)
  928. (*$IKREC1.PAS    *)
  929. (*$IKSEND1.PAS   *)
  930. (*$IRECEIVK2.PAS *)
  931. (*$IPIBDWLOC.PAS *)
  932.  
  933. (*-----------------------End Download procedures -----------------------*)
  934.  
  935. (*-----------------------CompuServe B Protocol--------------------------*)
  936.  
  937. (*$IDOCOMPUS.PAS *)
  938.  
  939. (*-----------------------End CompuServe B Protocol----------------------*)
  940.  
  941. (*$IEDITALIN.PAS *)
  942. (*$IGETAREAC.PAS *)
  943. (*$ISETPARMA.PAS *)
  944. (*$ISETPARMB.PAS *)
  945. (*$ISETPARMC.PAS *)
  946. (*$IREVIEWCA.PAS *)
  947. (*$IDISPLAYT.PAS *)
  948. (*$IDOSCDUMP.PAS *)
  949. (*$IGETCAPTU.PAS *)
  950. (*$IFASTCHNG.PAS *)
  951. (*$IDOSJUMP.PAS  *)
  952. (*$IPROCESSS.PAS *)
  953.  
  954. (*----------------------------------------------------------------------*)
  955. (*                 Dummy constant to break up overlay.                  *)
  956. (*----------------------------------------------------------------------*)
  957.  
  958. CONST
  959.    Dummy_Const = 99;
  960.  
  961. (*---------------------Primary character input/output handling----------*)
  962.  
  963. (*$ISENDFUNK.PAS *)
  964. (*$ICHECKWAI.PAS *)
  965. (*$IDISPLAYC.PAS *)
  966. (*$ITOGGLEOP.PAS *)
  967. (*$IPROCESSC.PAS *)
  968. (*$IGETSCRIP.PAS *)
  969. (*$IEXECUTEC.PAS *)
  970.  
  971. (*----------------------------------------------------------------------*)
  972. (*                 Second overlay segment starts here.                  *)
  973. (*----------------------------------------------------------------------*)
  974.  
  975. (*---------------------Ansi/VT100 Terminal Emulator --------------------*)
  976.  
  977. (*$IPIBANSIA.PAS *)
  978. (*$IPIBANSIB.PAS *)
  979.  
  980. (*---------------------------VT52 Terminal Emulator --------------------*)
  981.  
  982. (*$IPIBVT52.PAS  *)
  983.  
  984. (*--------------------------------Host Mode ----------------------------*)
  985.  
  986. (*$IPIBHOSTA.PAS *)
  987. (*$IPIBHOSTB.PAS *)
  988. (*$IPIBHOSTC.PAS *)
  989.  
  990. (*--------------------------Dumb Terminal Mode -------------------------*)
  991.  
  992. (*$IPIBDUMBT.PAS *)
  993.  
  994. (*--------------------------Gossip Mode---------------------------------*)
  995.  
  996. (*$IPIBGOSSI.PAS *)
  997.  
  998. (*--------------------------VT220 Terminal Emulator --------------------*)
  999.  
  1000. (*$IPIBVT220.PAS  *)
  1001.  
  1002. (*--------------------------TV920 Terminal Emulator --------------------*)
  1003.  
  1004. (*$IPIBTV920.PAS  *)
  1005.  
  1006. (*-----------------------TEK 4014 Terminal Emulator --------------------*)
  1007.  
  1008. (*$IPIBT4014.PAS  *)
  1009.  
  1010. (*----------------------PibTerm Initialization--------------------------*)
  1011.  
  1012. (*$IINITTERM.PAS *)
  1013.  
  1014. (* ------------------------------------------------------------------------ *)
  1015. (*                  PibTerm  --- Main Program                               *)
  1016. (* ------------------------------------------------------------------------ *)
  1017.  
  1018. BEGIN (* PibTerm  *)
  1019.                                    (* Get overlay directory *)
  1020.    InitOvly;
  1021.                                    (* Initialize PibTerm    *)
  1022.    InitTerm;
  1023.                                    (* Program finished flag *)
  1024.    PibTerm_Done := FALSE;
  1025.  
  1026.    REPEAT
  1027.                                    (* BEGIN Terminal Emulation *)
  1028.       CASE Terminal_To_Emulate Of
  1029.          VT52:     Emulate_VT52;
  1030.          Dumb:     Emulate_Dumb_Terminal;
  1031.          Ansi:     Emulate_Ansi( FALSE );
  1032.          VT100:    Emulate_Ansi( TRUE );
  1033.          Gossip:   Emulate_Gossip;
  1034.          HostMode: Emulate_Host;
  1035.          TV920:    Emulate_TV920;
  1036.          TEK4014:  Emulate_TEK4014;
  1037.          VT220:    Emulate_VT220;
  1038.       END (* CASE *);
  1039.  
  1040.    UNTIL ( PibTerm_Done );
  1041.                                    (* Close down serial port   *)
  1042.    Async_Close;
  1043.                                    (* Close capture file       *)
  1044.    IF Capture_On THEN
  1045.          (*$I-*)
  1046.       CLOSE( Capture_File );
  1047.          (*$I+*)
  1048.                                    (* Remove scrolling buffer  *)
  1049.    IF Review_Buffer <> NIL THEN
  1050.       FREEMEM( Review_Buffer , 81 * Max_Review_Length );
  1051.  
  1052.                                    (* Remove Interrupt 24 trap *)
  1053.    Int24OFF;
  1054.                                    (* Clear screen             *)
  1055.    ClrScr;
  1056.  
  1057. END   (* PibTerm  *).
  1058.